#ifndef VERTICES_H
#define VERTICES_H

#include "Vector3.h"
#include "VertexFormat.h"

namespace Cvekas {

#pragma pack(1)

struct VertexPos
{
	Vector3 pos;

	VertexPos()
		:
	pos()
	{
		assert(sizeof(VertexPos) == VertexPos::getSize());
	}

	VertexPos(const Vector3& pos)
		:
	pos(pos)
	{
		assert(sizeof(VertexPos) == VertexPos::getSize());
	}

	static const VertexFormat& getFormat()
	{
		static VertexFormat f(true, 0, false, false, false, false);
		return f;
	}

	static uint getSize()
	{
		return 12;
	}
};

struct VertexPosUV
{
	Vector3 pos;
	float u, v;

	VertexPosUV()
		:
	pos(), u(0.0f), v(0.0f)
	{
		assert(sizeof(VertexPosUV) == VertexPosUV::getSize());
	}

	VertexPosUV(const Vector3& pos, float u, float v)
		:
	pos(pos), u(u), v(v)
	{
		assert(sizeof(VertexPosUV) == VertexPosUV::getSize());
	}

	static const VertexFormat& getFormat()
	{
		static VertexFormat f(true, 1, false, false, false, false);
		return f;
	}

	static uint getSize()
	{
		return 20;
	}
};

struct VertexPosNormal
{
	Vector3 pos;
	Vector3 normal;

	VertexPosNormal()
		:
	pos(), normal()
	{
		assert(sizeof(VertexPosNormal) == VertexPosNormal::getSize());
	}

	VertexPosNormal(const Vector3& pos, const Vector3& normal)
		:
	pos(pos), normal(normal)
	{
		assert(sizeof(VertexPosNormal) == VertexPosNormal::getSize());
	}

	static const VertexFormat& getFormat()
	{
		static VertexFormat f(true, 0, true, false, false, false);
		return f;
	}

	static uint getSize()
	{
		return 24;
	}
};

struct VertexPosColor
{
	Vector3 pos;
	D3DCOLOR color;

	VertexPosColor()
		:
	pos(), color()
	{
		assert(sizeof(VertexPosColor) == VertexPosColor::getSize());
	}

	VertexPosColor(const Vector3& pos, const D3DCOLOR& color)
		:
	pos(pos), color(color)
	{
		assert(sizeof(VertexPosColor) == VertexPosColor::getSize());
	}

	static const VertexFormat& getFormat()
	{
		static VertexFormat f(true, 0, false, false, false, true);
		return f;
	}

	static uint getSize()
	{
		return 16;
	}
};

struct VertexPosUVColor
{
	Vector3 pos;
	float u, v;
	D3DCOLOR color;

	VertexPosUVColor()
		:
	pos(), u(0.0f), v(0.0f), color()
	{
		assert(sizeof(VertexPosUVColor) == VertexPosUVColor::getSize());
	}

	VertexPosUVColor(const Vector3& pos, float u, float v, const D3DCOLOR& color)
		:
	pos(pos), u(u), v(v), color(color) 
	{
		assert(sizeof(VertexPosUVColor) == VertexPosUVColor::getSize());
	}


	static const VertexFormat& getFormat()
	{
		static VertexFormat f(true, 1, false, false, false, true);
		return f;
	}

	static uint getSize()
	{
		return 24;
	}
};

// Add more as needed

#pragma pack()

} // namespace

#endif